package com.mcode.blog.controller;

import com.mcode.blog.service.SysUserService;
import com.mcode.blog.vo.Result;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;

@RequestMapping("users")
@RestController
public class UserController {

    @Resource
    private SysUserService sysUserService;

    /**
     * 根据token获取用户信息
     * @param token
     * @return
     */
    @GetMapping("/currentUser")
    public Result currentUser(@RequestHeader("Authorization") String token){
        return Result.success(sysUserService.findUserByToken(token));
    }
}
